/**
 * This interface contains methods that we expect any matrix class
 * to be able to perform.  It also contains a method that allows
 * us to verify whether the matrix representation really is performing
 * as expected.  Closely read the function specifications here to
 * ensure the matrices you implement perform as we expect. 
 * 
 * !!!!! DO NOT MODIFY THIS FILE !!!!!
 */

public interface Matrix
{
	
	/**
	 * getRows -- get the number of rows in the matrix
	 * @return the number of rows
	 */
	public int getRows();
	
	/**
	 * getCols -- get the number of columns in the matrix
	 * @return the number of columns
	 */
	public int getCols();
	
	/**
	 * init -- initialize the matrix to the given dimensions and
	 *   set all entries to zero
	 * @param rows the number of rows in the matrix
	 * @param cols the number of columns in the matrix
	 */
	public void init(int rows, int cols);
	
	/**
	 * clear -- initialize the matrix and set all values to zero
	 */
	public void clear();
	
	/**
	 * set -- set the value of the given row and column
	 * @param row the specified row
	 * @param col the specified column
	 * @param val the value to set
	 * @throws IllegalArgumentException for invalid row or column
	 */
	public void set(int row, int col, double val);
	
	/**
	 * get -- get the entry at the given row and column
	 * @param row the specified row
	 * @param col the specified column
	 * @return the value at row r and column c
	 * @throws IllegalArgumentException for invalid row or column
	 */
	public double get(int row, int col);
	
	/**
	 * getRow -- get all elements of the given row
	 * @param row the desired row
	 * @return the elements of the given row
	 * @throws IllegalArgumentException if illegal row
	 */
	public double[] getRow(int row);
	
	/**
	 * getCol -- get all elements of the given column
	 * @param col the desired column
	 * @return the elements of the given column
	 * @throws IllegalArgumentException if illegal column
	 */
	public double[] getCol(int col);
	
	/**
	 * rowSum -- get the summation of the entries of the given row
	 * @param row the desired row
	 * @return the sum of the entries of the given row
	 * @throws IllegalArgumentException if illegal row
	 */
	public double rowSum(int row);
	
	/**
	 * colSum -- get the summation of the entries of the given column
	 * @param col the desired column
	 * @return the sum of the entries of the given column
	 * @throws IllegalArgumentException if illegal column
	 */
	public double colSum(int col);
	
	/**
	 * add -- perform matrix addition, storing the resulting matrix
	 *   into the current object
	 * @param m
	 * @throws IllegalArgumentException if unequal dimensions
	 */
	public void add(Matrix m);
	
	/**
	 * sub -- subtract the given matrix, storing the resulting matrix
	 *   into the current object
	 * @param m
	 * @throws IllegalArgumentException if unequal dimensions
	 */
	public void sub(Matrix m);
	
	/**
	 * equals -- determine whether the matrices are equal
	 * @param m the matrix to compare
	 * @return true if the matrices have equal dimensions and all
	 *   entries are equal, false otherwise
	 */
	public boolean equals(Matrix m);
	
	/**
	 * isSymmetric -- determine whether the matrix is symmetric
	 * @return true if the matrix is square and symmetric,
	 *   false otherwise
	 */
	public boolean isSymmetric();
	
	/**
	 * checkRepresentation -- check whether the matrix conforms to its
	 *   representational invariants
	 * @return true if the invariants are satisfied, false otherwise
	 */
	public boolean checkRepresentation();
	
	/**
	 * importData -- import matrix data from a given stream (e.g. file)
	 * @return true if the import was successful, false otherwise
	 */
	public boolean importData(java.util.Scanner stream);
	
}
